In [1]:
%pylab inline
from sympy.interactive import init_printing
init_printing()
from sympy import pi, var, S
from sympy.utilities.codegen import codegen
The following code is taken from the article:
Čertík, O., Winkler, P. (2013). Computation of screened two-electron matrix elements. International Journal of Quantum Chemistry. doi:10.1002/qua.24431
In [2]:
from sympy import var, legendre, Integral, \
exp, latex
var("l R alpha t")
f = (2*l+1) / (2*t) * Integral(legendre(l, \
(1-R**2+t**2) / (2*t)) * \
exp(-alpha*R), (R, 1-t, 1+t))
for _l in range(3):
expr = f.subs(l, _l).doit().simplify( ) \
/ exp(-alpha)
expr = expr.series(alpha, 0, 14)
print " s_%d =" % _l, latex(expr)
In [3]:
f
Out[3]:
In [4]:
expr
Out[4]:
In [5]:
[(fname, fcode), (hfile, hcode)] = codegen(("f", expr), "F95", "test", header=False, empty=False)
In [6]:
fcode
Out[6]:
In [6]: